--配置路由实现,读库负载均衡   
USE [master]
GO

ALTER AVAILABILITY GROUP [AG01]
MODIFY REPLICA ON N'DB100121' WITH (SECONDARY_ROLE(READ_ONLY_ROUTING_URL = N'TCP://192.168.100.121:1433'))
GO

ALTER AVAILABILITY GROUP [AG01]
MODIFY REPLICA ON N'DB100122' WITH (SECONDARY_ROLE(READ_ONLY_ROUTING_URL = N'TCP://192.168.100.122:1433'))
GO

ALTER AVAILABILITY GROUP [AG01]
MODIFY REPLICA ON N'DB100123' WITH (SECONDARY_ROLE(READ_ONLY_ROUTING_URL = N'TCP://192.168.100.123:1433'))
GO

ALTER AVAILABILITY GROUP [AG01]
MODIFY REPLICA ON N'DB100121' WITH (PRIMARY_ROLE(READ_ONLY_ROUTING_LIST = ((N'DB100122',N'DB100123'),N'DB100121')))
GO

ALTER AVAILABILITY GROUP [AG01]
MODIFY REPLICA ON N'DB100122' WITH (PRIMARY_ROLE(READ_ONLY_ROUTING_LIST = ((N'DB100121',N'DB100123'),N'DB100122')))
GO

ALTER AVAILABILITY GROUP [AG01]
MODIFY REPLICA ON N'DB100123' WITH (PRIMARY_ROLE(READ_ONLY_ROUTING_LIST = ((N'DB100121',N'DB100122'),N'DB100123')))
GO




